﻿
using CommonModule;
using HalconDotNet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VisionModule;

namespace Demo
{
    public partial class ParamerSetting : Form
    {
        private List<Control> controls = new List<Control>();
        public ParamerSetting()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            //打开窗口
            ImageProcess.Instance.OpenWindow(this.pic_Show.Width, this.pic_Show.Height,
                this.pic_Show.Handle, this.pic_Show.Name);
            //绑定事件
            this.Load += ParamerSetting_Load;
            GetAllControls(this);
            for (int i = 0; i < controls.Count; i++)
            {
                if (controls[i] is NumericUpDown)
                {
                    NumericUpDown temp = controls[i] as NumericUpDown;
                    string s = temp.Name;
                    temp.ValueChanged += Temp_ValueChanged;
                }
            }
        }

        private void Temp_ValueChanged(object sender, EventArgs e)
        {
            NumericUpDown temp = sender as NumericUpDown;
            
        }
        /// <summary>
        /// 获得所有控件
        /// </summary>
        /// <param name="control"></param>
        private void GetAllControls(Control control)
        {
            foreach (Control item in control.Controls)
            {
                if (item.Controls.Count > 0)
                {
                    GetAllControls(item);
                }
                controls.Add(item);
            }
        }

        private void ParamerSetting_Load(object sender, EventArgs e)
        {

        }

        private void btn_GrabImage_Click(object sender, EventArgs e)
        {
            
        }
    }
}
